<?php

use Illuminate\Database\Seeder;
use App\Models\Category;

class GoodsTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $topCategories = Category::top()->get();
        $topCategories->each(function($category){
        	$category->subcates->each(function($sub){
        		$sub->goods()->saveMany(factory(\App\Models\Goods::class, 10)->make());
        	});
        });
    }
}
